<div class="grid-100 row">
    <div class="grid-content grid-100">
        <div class="grid-parent grid-100 container">
            <h1 class="section-label pull-left">Inventory Movement Task List</h1>
            <a class="create-button"  ui-sref="wms.task.inventoryMovementTask.historySearch"><b>Inventory Movement History Search</b></a>
        </div>
        <div class="grid-parent grid-100 container">
            <div class="grid-25">
                <label>Task ID #:</label>
                <lt-tags-input ng-model="search.taskIds" placeholder="Enter Task ID" fill="TASK-" ng-keyup="keyUpSearch($event)"> </lt-tags-input>
            </div>
            <div class="grid-25">
                <label class="label-input">Assignee</label>
                <user-auto-complete ng-model="search.assigneeUserId" allow-clear="true"></user-auto-complete>
            </div>
            <div class="grid-25">
                <label class="label-input">Status</label>
                <task-status-auto-complete ng-model="search.status" allow-clear="true"></task-status-auto-complete>
            </div>
            <div class="grid-25">
                <label class="label-input">Priority</label>
                <task-priority-auto-complete ng-model="search.priority" allow-clear="true"></task-priority-auto-complete>
            </div>
        </div>

        <div class="grid-parent grid-100 container">
            <div class="grid-25">
                <label>Start Time</label>
                <lt-date-time placeholder="From" date-format="yyyy-mm-dd hh:ii" minute-step="60" value="search.startTimeFrom"></lt-date-time>
            </div>
            <div class="grid-25" style="padding-top: 25px;">
                <lt-date-time placeholder="To" date-format="yyyy-mm-dd hh:ii" minute-step="60" value="search.startTimeTo"></lt-date-time>
            </div>
            <div class="grid-25">
                <label>End Time</label>
                <lt-date-time placeholder="From" date-format="yyyy-mm-dd hh:ii" minute-step="60" value="search.endTimeFrom"></lt-date-time>
            </div>
            <div class="grid-25" style="padding-top: 25px;">
                <lt-date-time placeholder="To" date-format="yyyy-mm-dd hh:ii" minute-step="60" value="search.endTimeTo"></lt-date-time>
            </div>
        </div>

        <div class="grid-parent grid-100 container">
            <div class="grid-90">&nbsp;</div>
            <div class="grid-10 ">
                <waitting-btn type="button" btn-class="ripplelink" ng-click="searchTasks()" value="'Search'" is-loading="loading"></waitting-btn>
            </div>
        </div>
    </div>
</div>
<div class="grid-100 row">
    <div class="grid-content grid-100">
        <div class="grid-parent grid-100 container">
            <table class="table">
                <thead>
                <tr>
                    <th>Task ID</th>
                    <th>Status</th>
                    <th>Priority</th>
                    <th>Assignee</th>
                    <th>Description</th>
                    <th>Created When</th>
                    <th>Updated When</th>
                    <th permission-check="{{'task::inventoryMovementTask_write'}}">Actions</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="task in tasks track by $index">
                    <td>
                        <a ng-href="{{'#/wms/task/inventory-movement-task/view/' + task.id}}" target="_blank">{{task.id}}</a>
                    </td>
                    <td>{{task.status}}</td>
                    <td>{{task.priority}}</td>
                    <td>{{task.assignee.firstName}} {{task.assignee.lastName}}</td>
                    <td>{{task.description}}</td>
                    <td>{{task.createdWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}
                        <span ng-show="task.createdBy">({{task.createdBy}})</span>
                    </td>
                     <td>{{task.updatedWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}<span ng-show="task.updatedBy">({{task.updatedBy}})</span></td>
                    <td permission-check="{{'task::inventoryMovementTask_write'}}">
                        <a ng-click="deleteTask(task.id)" title="Delete"
                           ng-show="task.status == 'New'">Delete</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

<div class="grid-100">
    <div class="grid-content grid-100">
        <unis-pager total-count="paging.totalCount" current-page ="paging.pageNo" page-size="pageObj.pageSize" load-content="loadContent(currentPage)"></unis-pager>
    </div>
</div>